import request from "@/utils/request";
import Qs from "qs";

// 获取方案列表
export function getList(params) {
  return request({
    url: "/api/ffile/getWebList",
    method: "get",
    params,
  });
}

// 获取推荐方案列表
export function getRcmdReport(data) {
  return request({
    url: "/api/web/getRcmdFiles",
    method: "post",
    data,
  });
}

// 获取方案类型
export function getFileReportTypeList(data) {
  return request({
    url: "/api/v2/file/getFileReportTypeList",
    method: "post",
    data,
  });
}
// 获取热榜方案列表
export function getHotReportList(data) {
  return request({
    url: "/api/web/getHotRankList",
    method: "post",
    data,
  });
}

// 获取主题方案
export function getThemeReport(data) {
  return request({
    url: "/api/ffile/apiindex",
    method: "post",
    data,
  });
}

// 获取文件的详情
export function getInfo(fid) {
  return request({
    url: "/api/doc/getDetail",
    method: "post",
    data: {
      fid: fid,
    },
  });
}

// 获取文件夹方案
export function getDirReports(pid, page) {
  return request({
    url: "/api/ffile/apiDirFiles",
    method: "post",
    data: {
      parent_id: pid,
      page: page,
    },
  });
}

// 记录
export function recordFile(id) {
  return request({
    url: "/api/ffile/recordFile",
    method: "post",
    data: {
      op_type: 1,
      fid: id,
      op_from: 1,
    },
  });
}

// 收藏文件
export function collect(data) {
  return request({
    url: "/api/user/doFavorite",
    method: "post",
    data,
  });
}

// 获取记录
export function getFileVRecords(data1) {
  return request({
    url: "/api/doc/getFileVRecords",
    method: "post",
    data:data1,
  });
}

// 搜索
export function search(data) {
  return request({
    url: "/api/doc/search",
    method: "post",
    data,
  });
}

// 获取文件夹下的文件
export function getReportByFolder(data) {
  return request({
    url: "/api/ffile/apiDirFiles",
    method: "post",
    data,
  });
}

// 创建任务
export function pdf2png(ossName, pageDir) {
  return request({
    url: "/api/web/doc2png",
    method: "post",
    data: {
      oss_name: ossName, // PDF在线位置
      page_dir: pageDir, // 页存储地址
    },
  });
}

// 检查任务
export function checkTask(taskId) {
  return request({
    url: "/api/web/checkTask",
    method: "post",
    data: {
      task_id: taskId,
    },
  });
}

export function getCost(fid) {
  return request({
    url: "/api/doc/getFileCostInfo",
    method: "post",
    data: {
      id: fid,
    },
  });
}

export function costTea(fid) {
  return request({
    url: "/api/user/costTea",
    method: "post",
    data: {
      id: fid,
    },
  });
}

export function getDetail(fid) {
  return request({
    url: "/api/doc/getDetail",
    method: "post",
    data: {
      fid: fid,
      opFrom: 1,
    },
  });
}
export function getDetailUrl(fid ) {
  return request({
    url: "/api/v2/file/pdfFileDownload",
    method: "post",
    data: {
      fileId: fid   },
  });
}
export function reportDetail(data) {
  return request({
    url: "/api/ffile/getDetail",
    method: "post",
    data,
  });
}

export function reportDetailGuest(data) {
  return request({
    url: "/api/ffile/getDetailByGuest",
    method: "post",
    data,
  });
}

export function detailsCount(fileId) {
  return request({
    url: "/api/v2/file/detectionOpenFileDetailsCount",
    method: "post",
    data: { fileId: fileId },
  });
}

export function getCatalog(fileId) {
  return request({
    url: "/api/v2/file/getCatalogListByFileId",
    method: "post",
    data: { fileId: fileId, pageSize: 3000 },
  });
}

export function getParagraph(fileId, search_key) {
  return request({
    url: "/api/v2/file/getParagraphListByFileId",
    method: "post",
    data: { fileId: fileId, pageSize: 3000, keyword: search_key },
  });
}

export function getChart(fileId) {
  return request({
    url: "/api/v2/file/getChartListByFileId",
    method: "post",
    data: { fileId: fileId, pageSize: 3000 },
  });
}
export function getSimilarReport(fileId) {
  return request({
    url: "/api/v2/file/getSimilarReportFile",
    method: "post",
    data: { fileId: fileId, limit: 3 },
  });
}

export function getSimilarChart(fileId) {
  return request({
    url: "/api/v2/file/getSimilarReportChart",
    method: "post",
    data: { fileId: fileId, limit: 3 },
  });
}

export function getReportTypeList(page, typeId) {
  return request({
    url: "/api/v2/fileReportType/getList",
    method: "post",
    data: { page: page, pageSize: 10, typeId: typeId },
  });
}
// 获取文件方案类型标签列表
export function getFileReportTypeTags() {
  return request({
    url: "/api/v2/tag/getFileReportTypeTags",
    method: "post",
  });
}
// 获取文件行业标签列表
export function getFileIndustryTags(parentFileIndustryId) {
  return request({
    url: "/api/v2/tag/getFileIndustryTags",
    method: "post",
    data: { parentFileIndustryId: parentFileIndustryId },
  });
}
// 获取文件行业标签列表
export function getMyThemes() {
  return request({
    url: "/api/theme/apiIndex",
    method: "post",
  });
}
